// eslint-disable-next-line @typescript-eslint/no-var-requires
module.exports = {
  css: {
    loaderOptions: {
      // 给 less-loader 传递 Less.js 相关选项
      less:{
        // http://lesscss.org/usage/#less-options-strict-units `Global Variables`
        // `primary` is global variables fields name
        lessOptions: {
          javascriptEnabled: true
        }
      }
    }
  },
  publicPath: process.env.NODE_ENV === 'production'
    ? '/fiber-demo-web/'
    : '/',
  chainWebpack: config => {
    config.when(process.env.NODE_ENV === 'production', config => {
      config.optimization.minimizer('terser').tap(options => {
        // eslint-disable-next-line @typescript-eslint/camelcase
        options[0].terserOptions.compress.drop_console = true
        options[0].terserOptions.extractComments = 'all'
        options[0].extractComments = true
        options[0].cache = true
        options[0].parallel = true
        options[0].sourceMap = false
        return options
      })
    })
  }
}